//
//  LGCreateTeamController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/2/16.
//  创建团队

#import "LGCreateTeamController.h"
//添加团队成员
#import "LGTeamMemberController.h"
#import "LGCreateTeamInputView.h"
@interface LGCreateTeamController ()

/**   */
@property (nonatomic , strong)LGCreateTeamInputView *titleView;
/**   */
@property (nonatomic , strong)LGCreateTeamInputView *introduceView;
/**   */
@property (nonatomic , strong)UIButton *addBtn;

@end

@implementation LGCreateTeamController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"创建团队";
    [self.view addSubview:self.titleView];
    [self.view addSubview:self.introduceView];
    [self.view addSubview:self.addBtn];
}

-(void)setBackVC:(UIViewController *)backVC{
    _backVC = backVC;
}

//添加成员
-(void)addBtnAction{
    if(self.titleView.content.length == 0){
        [TooltipView showMessage:@"请输入团队名称" offset:0];
        return;
    }
    
    LGTeamMemberController *controller = [[LGTeamMemberController alloc]init];
    controller.teamId = @"0";
    controller.type = @"add";
    controller.backVC = self.backVC;
    controller.teamTitle = self.titleView.content;
    controller.teamIntroduce = self.introduceView.content.length>0?self.introduceView.content:@"";
    [self.navigationController pushViewController:controller animated:YES];
}


-(LGCreateTeamInputView *)titleView{
    if(!_titleView){
        _titleView = [[LGCreateTeamInputView alloc] initWithFrame:CGRectMake(viewPix(16), viewPix(16), Screen_W-viewPix(32), viewPix(112))];
        [_titleView setShadoWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:15];
        _titleView.backgroundColor = [UIColor whiteColor];
        _titleView.title = @"团队名称";
        _titleView.maxNum = 20;
    }
    return _titleView;
}

-(LGCreateTeamInputView *)introduceView{
    if(!_introduceView){
        _introduceView = [[LGCreateTeamInputView alloc] initWithFrame:CGRectMake(viewPix(16), kMaxY(self.titleView.frame)+viewPix(16), Screen_W-viewPix(32), viewPix(327))];
        [_introduceView setShadoWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:15];
        _introduceView.backgroundColor = [UIColor whiteColor];
        _introduceView.title = @"团队介绍";
        _introduceView.maxNum = 500;
    }
    return _introduceView;
}

-(UIButton *)addBtn{
    if(!_addBtn){
        _addBtn = [UIButton buttonWithTitle:@"去添加成员" topMargin:kMaxY(self.introduceView.frame)+viewPix(45)];
        [_addBtn addTarget:self action:@selector(addBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _addBtn;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
